
chrome.webRequest.onBeforeRequest.addListener((detail):any => {
  if (detail.url === 'https://css.ccement.com/m_ccement_com/short_video/js/input-bundle.js') {
    console.log('onBeforeRequest', detail)
    detail.url = 'http://localhost:5501/js/input-bundle.js'
    console.log('bbb')
  }
}, { urls: [ '<all_urls>' ] }, [ 'extraHeaders', 'requestBody' ])

chrome.webRequest.onResponseStarted.addListener((detail) => {
  if (detail.url === 'https://css.ccement.com/m_ccement_com/short_video/js/input-bundle.js') {
    console.log('onResponseStarted', detail)
  }
}, { urls: [ '<all_urls>' ] })

chrome.declarativeNetRequest.updateDynamicRules({
  addRules: [
    {
      'id': 1,
      'priority': 1,
      'action': { 'type': 'block' },
      'condition': {
        'urlFilter': 'abc',
        'domains': [ 'css.ccement.com' ],
        'resourceTypes': [ 'script' ],
      },
    },
  ],
}, async (result: any) => {
  console.log('created', result)
})

export default {}
